package bishizhuanyong.度小满;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n= sc.nextInt();
        int h = sc.nextInt();
        int[][] nums=new int[n][2];
        int left=Integer.MAX_VALUE;
        int right=Integer.MIN_VALUE;
        for (int i=0;i<n;i++){
            nums[i][0]=sc.nextInt();
            nums[i][1]=sc.nextInt();
            left=Math.min(left,nums[i][0]);
            right=Math.max(right, nums[i][1]);
        }
        long[] depth=new long[right-left+1];
        for (int i=0;i<n;i++){
            int start=nums[i][0];
            int end=nums[i][1]-1;
            for (int j=start-left;j<=end-left;j++)
                depth[j]++;
        }
        long res=0;
        for (int i=0;i< depth.length;i++){
            if (depth[i]>=h)
                res++;
        }
        System.out.println(res);
    }


}
